package truef.commodity.domain;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import edu.zut.cs.software.base.domain.BaseTreeEntity;


@Table(name = "T_COMCATEGORY")
@Entity
@NamedQueries({ @NamedQuery(name = "ComCategory.getRoot", query = "select g from ComCategory g where g.parent is null") })
public class ComCategory extends BaseTreeEntity<ComCategory>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1938780104569122744L;
	
	@Column(name = "NAME")
	String name;
	
	@Column(name = "COMMODITY")
	@OneToMany(mappedBy = "comcategory", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	Set<Commodity> commodities;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
